home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-08-16 | 5.9 KB | 207 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: PRWinPro.h
- // Release Version: $ ODF 1 $
- //
- // Copyright: (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #include "FWOS.hpp"
-
- #ifndef FWODTYPS_H
- #include "FWODTyps.h"
- #endif
-
- #ifndef PRWINPRO_H
- #include "PRWinPro.h"
- #endif
-
- #ifndef FWODEXCE_H
- #include "FWODExce.h"
- #endif
-
- #ifndef SLWINDOW_H
- #include "SLWindow.h"
- #endif
-
- #ifndef FWRECT_H
- #include "FWRect.h"
- #endif
-
- #ifndef FWFXMATH_H
- #include "FWFxMath.h"
- #endif
-
- #ifndef FWSTRING_H
- #include "FWString.h"
- #endif
-
- // ----- OpenDoc Utilities -----
-
- #ifndef _STDTYPIO_
- #include "StdTypIO.h"
- #endif
-
- #ifndef _STORUTIL_
- #include "StorUtil.h"
- #endif
-
- // ----- OpenDoc Includes -----
-
- #ifndef SOM_Module_OpenDoc_Errors_defined
- #include <ErrorDef.xh>
- #endif
-
- #ifndef SOM_ODStorageUnit_xh
- #include <StorageU.xh>
- #endif
-
- #ifndef SOM_ODDraft_xh
- #include <Draft.xh>
- #endif
-
- #ifndef SOM_ODFrame_xh
- #include <Frame.xh>
- #endif
-
- #ifndef SOM_Module_OpenDoc_StdTypes_defined
- #include <StdTypes.xh>
- #endif
-
- #ifndef SOM_Module_OpenDoc_StdProps_defined
- #include <StdProps.xh>
- #endif
-
- //========================================================================================
- // Runtime Info
- //========================================================================================
-
- #ifdef FW_BUILD_MAC
- #pragma segment fwwindow
- #endif
-
- //========================================================================================
- // WindowProperties API
- //========================================================================================
-
- //----------------------------------------------------------------------------------------
- // FW_PrivInitWindowProperties
- //----------------------------------------------------------------------------------------
-
- FW_PlatformError SL_API FW_PrivInitWindowProperties(FW_SWindowProperties* windowProperties)
- {
- // No try block necessary - Do not throw
- #ifdef FW_BUILD_MAC
- FW_CPoint interiorSize(
- FW_IntToFixed(FW_QDGlobals.screenBits.bounds.right - 64),
- FW_IntToFixed(FW_QDGlobals.screenBits.bounds.bottom - LMGetMBarHeight() - 4 - 4 - 20));
- FW_CPoint position(FW_IntToFixed(4), FW_IntToFixed(LMGetMBarHeight() + 4 + 19));
- FW_CRect rect(position.x, position.y, position.x + interiorSize.x, position.y + interiorSize.y);
- windowProperties->fBoundsRect = rect;
-
- windowProperties->fMacTitle[0] = 0;
- windowProperties->fMacProcID = FW_PrivMacStyleToProcId(FW_kDocumentWindow);
- windowProperties->fMacHasCloseBox = TRUE;
- windowProperties->fMacRefCon = 0;
- #endif
-
- #ifdef FW_BUILD_WIN
- FW_DEBUG_MESSAGE("Not Yet Implemented");
- #endif
-
- windowProperties->fWasVisible = TRUE;
- windowProperties->fIsFloating = FALSE;
- windowProperties->fIsRootWindow = TRUE;
- windowProperties->fShouldShowLinks = FALSE;
- windowProperties->fSourceFrame = NULL;
- windowProperties->fIsResizable = TRUE;
-
- return FW_xNoError;
- }
-
- //----------------------------------------------------------------------------------------
- // FW_PrivReadWindowProperties
- //----------------------------------------------------------------------------------------
-
- FW_Boolean SL_API FW_PrivReadWindowProperties(Environment* ev, FW_SWindowProperties* windowProperties, ODFrame* frame)
- {
- FW_Boolean result = FALSE;
-
- FW_TRY
- {
- // ----- Initialize the property record -----
- if (windowProperties->fSourceFrame)
- windowProperties->fSourceFrame->Release(ev);
- FW_PrivInitWindowProperties(windowProperties);
-
- // ----- read -----
- ODStorageUnit* frameSU = frame->GetStorageUnit(ev);
- ODStorageUnit* windowPropsSU = kODNULL;
-
- ODID id = ODGetStrongSURefProp(ev, frameSU, kODPropWindowProperties, kODStrongStorageUnitRef);
- if (id == 0)
- return FALSE;
-
- #if FW_OPENDOC_VERSION >= FW_OPENDOC_DR3
- windowPropsSU = frameSU->GetDraft(ev)->AcquireStorageUnit(ev,id);
- #else
- windowPropsSU = frameSU->GetDraft(ev)->GetStorageUnit(ev,id);
- #endif
-
- if (windowPropsSU)
- {
- ODRect odRect;
- ODGetRectProp(ev, windowPropsSU, kODPropWindowRect, kODRect, &odRect);
- windowProperties->fBoundsRect = FW_CRect(odRect);
-
- #ifdef FW_BUILD_MAC
- ODIText* iText = ODGetITextProp(ev, windowPropsSU, kODPropWindowTitle, kODMacIText, NULL);
- if (iText)
- {
- FW_CString string(iText);
- string.ExportPascal(windowProperties->fMacTitle);
- ::DisposeIText(iText);
- }
-
- windowProperties->fMacProcID = ODGetSShortProp(ev, windowPropsSU, kODPropWindowProcID, kODSShort);
- windowProperties->fMacHasCloseBox = ODGetBooleanProp(ev, windowPropsSU, kODPropWindowHasCloseBox, kODBoolean);
- windowProperties->fMacRefCon = ODGetSLongProp(ev, windowPropsSU, kODPropWindowRefCon, kODSLong);
- #endif
-
- windowProperties->fIsResizable = ODGetBooleanProp(ev, windowPropsSU, kODPropWindowIsResizable, kODBoolean);
- windowProperties->fWasVisible = ODGetBooleanProp(ev, windowPropsSU, kODPropWindowIsVisible, kODBoolean);
- windowProperties->fShouldShowLinks = ODGetBooleanProp(ev, windowPropsSU, kODPropShouldShowLinks, kODBoolean);
-
- windowProperties->fIsFloating = ODGetBooleanProp(ev, windowPropsSU, kODPropWindowIsFloating, kODBoolean);
- windowProperties->fIsRootWindow = ODGetBooleanProp(ev, windowPropsSU, kODPropWindowIsRootWindow, kODBoolean);
-
- if (windowPropsSU->Exists(ev, kODPropSourceFrame, kODStrongStorageUnitRef, 0))
- {
- ODID id = ODGetStrongSURefProp(ev, windowPropsSU, kODPropSourceFrame, kODStrongStorageUnitRef);
- #if FW_OPENDOC_VERSION >= FW_OPENDOC_DR3
- windowProperties->fSourceFrame = windowPropsSU->GetDraft(ev)->AcquireFrame(ev, id);
- #else
- windowProperties->fSourceFrame = windowPropsSU->GetDraft(ev)->GetFrame(ev, id);
- #endif
- }
-
- windowPropsSU->Release(ev);
-
- result = TRUE;
- }
- }
- FW_CATCH_BEGIN
- FW_CATCH_REFERENCE(FW_XException, exception)
- {
- FW_SetException(ev, exception);
- }
- FW_CATCH_EVERYTHING ()
- {
- FW_SetEvError(ev, kODErrUndefined);
- }
- FW_CATCH_END
-
- return result;
- }
-